﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using KL.UFrame.Data.Entities;
using Newtonsoft.Json;

namespace KL.UFrame.Data.Models
{
    public class VenueModel:CurdModel
    {
        [Required(ErrorMessage = "{0}不能为空")]
        [StringLength(100, ErrorMessage = "{0}长度不能超过{1}位")]
        [Display(Name = "名称")]
        public string Name { get; set; }

        [Required(ErrorMessage = "{0}不能为空")]
        [StringLength(100,ErrorMessage = "{0}长度不能超过{1}位")]
        [Display(Name = "用途")]
        public string Purpose { get; set; }

        [Required(ErrorMessage = "{0}不能为空")]
        [Display(Name = "面积(平方米)")]
        public int Area { get; set; }

        [Required(ErrorMessage = "{0}不能为空")]
        [Display(Name = "容纳人数")]
        public int Capacity { get; set; }

        [Required(ErrorMessage = "{0}不能为空")]
        [StringLength(100, ErrorMessage = "{0}长度不能超过{1}位")]
        [Display(Name = "设备")]
        public string Devices { get; set; }

        [StringLength(200, ErrorMessage = "{0}长度不能超过{1}位")]
        [Display(Name = "背景图")]
        public string  ImageUrl { get; set; }

        [StringLength(200, ErrorMessage = "{0}长度不能超过{1}位")]
        [Display(Name = "前景图")]
        public string FrontImageUrl { get; set; }
    }

    public class VenueBookModel
    {
        public int VenueId { get; set; }

        public int Month { get; set; }

        public VenueBookDay[] BookDays { get; set; }
    }

    public class VenueBookDay
    {
        public string Day { get; set; }

        public string BookType { get; set; }
    }

    public class VenueBookCreateModel
    {
        [Required(ErrorMessage = "{0}不能为空")]
        [Display(Name = "场馆编号")]
        public int VenueId { get; set; }

        [Required(ErrorMessage = "{0}不能为空")]
        [Display(Name = "预定人")]
        [StringLength(50, ErrorMessage = "{0}长度不能超过{1}位")]
        public string BookName  { get; set; }

        [Required(ErrorMessage = "{0}不能为空")]
        [Display(Name = "预定电话")]
        [StringLength(11, ErrorMessage = "{0}长度不能超过{1}位")]
        public string BookPhone { get; set; }

        [Required(ErrorMessage = "{0}不能为空")]
        [Display(Name = "用途")]
        [StringLength(500,ErrorMessage = "{0}长度不能超过{1}位")]
        public string Reason { get; set; }

        public VenueBookDay[] Days { get; set; }
    }

    public class VenueBookRecordSearchModel
    {
        [Required(ErrorMessage = "请输入{0}")]
        [Display(Name = "手机号")]
        public string Phone { get; set; }

        [Required(ErrorMessage = "请输入{0}")]
        [Display(Name = "开始日期")]
        public DateTime Start { get; set; }

        [Required(ErrorMessage = "请输入{0}")]
        [Display(Name = "结束日期")]
        public DateTime End { get; set; }

        public List<VenueBookRecordSearchResultModel> Results { get; set; }
        

    }

    public class VenueBookRecordSearchResultModel
    {
        public int VenueId { get; set; }

        public string VenueName { get; set; }

        public string BookName { get; set; }
        
        public string BookPhone { get; set; }
        
        public string Reason { get; set; }

        public List<VenueBookDay> Days { get; set; }
        public int Capacity { get; set; }
        public string Devices { get; set; }
        public int Area { get; set; }
        public string Purpose { get; set; }
        public DateTime? BookTime { get; set; }
        public VenueBookRecordStatus Status { get; internal set; }
        public string StatusDescription { get; internal set; }
        public int Id { get; internal set; }
    }
}